// const { AsyncParallelHook } = require('tapable')
const AsyncParallelHook = require('./AsyncParallelHook.js')
let hook = new AsyncParallelHook(['name', 'age'])

console.time('time')

hook.tapAsync('fn1', (name, age, callback) => {
    setTimeout(() => {
        console.log('fn1 ----> ', name, age);
        callback()
    }, 1000)
})

hook.tapAsync('fn2', (name, age, callback) => {
    setTimeout(() => {
        console.log('fn2 ----> ', name, age);
        callback()
    }, 2000)
})


hook.callAsync('lg',100, () => {
    console.log('完成了');
    console.timeEnd('time')
})